<?php

declare (strict_types = 1);

namespace app\admin\controller;

use app\common\controller\AdminBase;
use app\common\model\Question as QuestionModel;

class Question extends AdminBase
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index()
    {
        $list = QuestionModel::order('id asc')->paginate(['query' => $this->request->param()]);
        return view('', \compact('list'));
    }

    /**
     * 显示编辑资源表单页.
     *
     * @param  int  $id
     * @return \think\Response
     */
    public function edit($id)
    {
        if ($this->request->isPost()) {
            $result = QuestionModel::update($this->request->post());
            if ($result) {
                $this->success('操作成功');
            } else {
                $this->error('操作失败');
            }
        }
    }
}
